﻿using System;
using System.Collections.Generic;

namespace DevicesView.Logic.App
{
    [Serializable]
    public class AppNetConfig
    {
        public List<NetServer> Servers { get; set; }



        public static AppNetConfig CreateNetConfig()
        {
#if DEBUG
            return AppNetConfig.Default;
#elif Test
             return  AppNetConfig.TestDefault;
#elif RC
             return  AppNetConfig.RcDefault;
#endif
        }
        /// <summary>
        /// 开发配置
        /// </summary>
        private static AppNetConfig Default
        {
            get
            {
                AppNetConfig netconfig = new AppNetConfig();
                List<NetServer> list = new List<NetServer>();
                netconfig.Servers = list;
                list.Add(new NetServer { Address = "http://localhost:5921/api/", ServerName = "LogicServiceAddress", Remarks = "逻辑服务器" });
                list.Add(new NetServer { Address = "http://rpfield-zlerp.oss-cn-beijing.aliyuncs.com/", ServerName = "OSSServer", Remarks = "OSS" });
                list.Add(new NetServer { Address = "http://testdataapi.warmsoft.com:10086/WebData/", ServerName = "XiannuanWebServer", Remarks = "小暖后端服务器" });
                return netconfig;
            }
        }

        /// <summary>
        /// 测试配置
        /// </summary>
        private static AppNetConfig TestDefault
        {
            get
            {
                AppNetConfig netconfig = new AppNetConfig();
                List<NetServer> list = new List<NetServer>();
                netconfig.Servers = list;
                list.Add(new NetServer { Address = "http://140.143.203.114:80/api/", ServerName = "LogicServiceAddress", Remarks = "逻辑服务器" });
                list.Add(new NetServer { Address = "http://rpfield-zlerp.oss-cn-beijing.aliyuncs.com/", ServerName = "OSSServer", Remarks = "OSS" });
                list.Add(new NetServer { Address = "http://testdataapi.warmsoft.com:10086/WebData/", ServerName = "XiannuanWebServer", Remarks = "小暖后端服务器" });
                return netconfig;
            }
        }


        /// <summary>
        /// 线上配置
        /// </summary>
        private static AppNetConfig RcDefault
        {
            get
            {
                AppNetConfig netconfig = new AppNetConfig();
                List<NetServer> list = new List<NetServer>();
                netconfig.Servers = list;
                list.Add(new NetServer { Address = "http://140.143.203.114:80/api/", ServerName = "LogicServiceAddress", Remarks = "逻辑服务器" });
                list.Add(new NetServer { Address = "http://rpfield-zlerp.oss-cn-beijing.aliyuncs.com/", ServerName = "OSSServer", Remarks = "OSS" });
                list.Add(new NetServer { Address = "http://115.28.170.18:10086/WebData/", ServerName = "XiannuanWebServer", Remarks = "小暖后端服务器" });
                return netconfig;
            }
        }

    }


    public class NetServer
    {
        /// <summary>
        /// 使用的协议如http,ftp,tcp,udp 
        /// </summary>
        public string Agreement { get; set; }
        /// <summary>
        /// 基地址如:http://www.12306.cn 如果是IP加端口  请用如下格式127.0.0.1:8080
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 测试地址
        /// </summary>
        public string TestAddress { get; set; }

        /// <summary>
        /// 服务器名称 唯一
        /// </summary>
        public string ServerName { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; }
    }
}
